package com.qdxwx.data.service.card;

import com.qdxwx.data.mapper.card.CardCourseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *CardCourse接口
 * Qdx NetSchool Platform
 * @author qdxwx
 * @updateTime 2022/5/25
 * @description
 */
@Service
public class CardCourseServiceImpl implements CardCourseService {

 	@Autowired
    private CardCourseMapper cardCourseMapper;

    @Override
    public int insert(long cardId, int courseId) {
        return cardCourseMapper.insert(cardId, courseId);
    }

    @Override
    public int insertBatch(long cardId, List<Integer> courseIds) {
        return cardCourseMapper.insertBatch(cardId, courseIds);
    }

    @Override
    public int deleteByCardId(long cardId) {
        return cardCourseMapper.deleteByCardId(cardId);
    }

    /**
     * 根据条件获取CardCourse列表
     * @param cardId 查询条件
     * @return List<CardCourse>
     */
    @Override
    public List<Integer> getCourseIds(Long cardId){
        if (cardId<1) return null;
    	return cardCourseMapper.selectCourseIds(cardId);
    }
}